<template>
  <div>
    <my-bread :list="['商品管理', '商品列表']"></my-bread>
    <el-card class="box-card">
      <el-row :gutter="20">
        <el-col :span="6"
          ><el-input placeholder="请输入内容" v-model="reqParams.query">
            <el-button
              slot="append"
              icon="el-icon-search"
              @click="search()"
            ></el-button>
          </el-input>
        </el-col>
        <el-col :span="18">
          <el-button type="primary" @click="addGoods()">添加商品</el-button>
        </el-col>
      </el-row>
      <el-table border style="width:100%" row-key="cat_id" :data="goodsList">
        <el-table-column type="index" prop="" label="序号"></el-table-column>
        <el-table-column
          prop="goods_name"
          width="400"
          label="商品名称"
        ></el-table-column>
        <el-table-column
          prop="goods_price"
          label="商品价格（元）"
        ></el-table-column>
        <el-table-column prop="goods_number" label="商品数量"></el-table-column>
        <el-table-column prop="goods_weight" label="商品重量"></el-table-column>
        <el-table-column label="创建时间">
          <template slot-scope="scope">
            {{ scope.row.add_time | ft }}
          </template>
        </el-table-column>

        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button
              type="primary"
              icon="el-icon-edit"
              size="mini"
            ></el-button>
            <el-button
              type="danger"
              icon="el-icon-delete"
              size="mini"
              @click="delGoods(scope.row.goods_id)"
            ></el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页效果 -->
      <el-pagination
        background
        layout="prev, pager, next"
        :current-page="reqParams.pagenum"
        :page-count="total"
        @current-change="pager"
      >
      </el-pagination>
    </el-card>
  </div>
</template>

<script>
import mixin from "./Goods-Mixin";
export default {
  mixins: [mixin]
};
</script>

<style lang="less" scoped></style>
